package com.anXin.user.controller;


import com.anXin.model.common.dtos.ResponseResult;
import com.anXin.model.user.pojos.User;
import com.anXin.model.user.pojos.UserEquipment;
import com.anXin.user.service.UserEquipmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "个人设备接口" )
@RestController
@RequestMapping("/equipment")
public class EquipmentController {
    @Resource
    private UserEquipmentService userEquipmentService;

    @ApiOperation("绑定设备")
    @PostMapping("/add")
    private ResponseResult add(@RequestBody UserEquipment userEquipment){
        return userEquipmentService.add(userEquipment);
    }
    @ApiOperation("更新设备")
    @PutMapping("/update")
    private ResponseResult updateEquipment(@RequestBody UserEquipment userEquipment){
        return userEquipmentService.updateEquipment(userEquipment);
    }
    @ApiOperation("解除设备绑定")
    @DeleteMapping("/delete/{id}")
    private ResponseResult delete(@PathVariable("id") Long id){
        return userEquipmentService.delete(id);
    }

    @ApiOperation("获取该老人绑定的设备列表")
    @GetMapping("/list/{id}")
    private ResponseResult getList(@PathVariable("id")  Long id){
        return userEquipmentService.getList(id);
    }

    @ApiOperation("获取绑定的设备信息")
    @GetMapping("/Info/{id}")
    public ResponseResult Info(@PathVariable("id")  Long id) {
        return userEquipmentService.Info(id);
    }
}
